package demo1;

public class Animal {
    public String name;
    protected int age;

    static {
        System.out.println("Animal的静态代码块被执行...");
    }

    {
        System.out.println("Animal的实例代码块被执行");
    }

    public Animal(String name, int age){
        this.name = name;
        this.age = age;
        System.out.println("带两个参数的构造方法被执行");
    }

    public Animal(){
        System.out.println("不带参数的构造方法被执行...");
    }

    public void eat(){
        System.out.println(this.name + "正在吃饭...");
    }

}
